package cn.keepme.redis;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.keepme.redis.service.RedisService;

public class TestRedis {

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		ApplicationContext factory = new ClassPathXmlApplicationContext(
				"classpath:spring-redis.xml");

		RedisService rs = (RedisService) factory.getBean("redisService");
		if (rs != null) {
			System.out.println("RedisService : " + rs);
			if (rs.check("lwj", "123456")) {
				System.out
						.println("redis has contianed </span><span style=\"font-family: 微软雅黑;\">lwj 123456</span><span style=\"font-family: 微软雅黑;\">\");</span><span style=\"font-family:微软雅黑;\">");
				System.out
						.println("add one new key-value : lwj 1234567 expire 15000");
				rs.set("lwj", "123456", 15000);
			} else {
				System.out
						.println("add one new key-value : lwj 123456 expire 15000");
				rs.set("lwj", "1234567", 15000);
			}

			String value = rs.get("lwj");
			System.out.println(value);
		}
	}
}
